package com.test.pattern.observer.before;

/**
 * @ClassName: Client
 * @description:
 * @author: Mr du
 * @create: 2024-03-14 22:49
 */
public class Client {

    public static void main(String[] args) {
        //创建主题对象
        Subject subject = new SubscriptionSubject();
        //创建观察者对象,微信用户相关对象
        Observer user1 = new WeixinUser("孙悟空");
        Observer user2 = new WeixinUser("猪悟能");
        Observer user3 = new WeixinUser("沙悟净");
        //订阅公众号
        subject.attach(user1);
        subject.attach(user2);
        subject.attach(user3);
        //公众号更新发出消息给订阅的微信用户
        subject.notify("祝老杜2024年事业有成");
    }
}
